home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / REXX.lha / autodoc.wrx next >
Text File  |  1995-05-01  |  2KB  |  98 lines

  1. /** $VER: Autodoc.ttx 1.0 (5.Aug.91)
  2.  ** Written by David N. Junod
  3.  **
  4.  ** Display hypertext Autodoc page.
  5.  **
  6.  ** Add the following lines to your S:user-startup file.
  7.  **
  8.  **   RX "AddLib('amigaguide.library',0,-30)"
  9.  **   RX "LoadXRef('autodocs.xref')"
  10.  **
  11.  ** 23/09/93 - adapted for the WRITE editor by MGR, Asgard - Lars Hanke
  12.  ** 07/02/94 - eliminated AmigaGuide programs calls and replaced them by
  13.  **            amigaguide.library calls.
  14.  **
  15.  **/
  16.  
  17. OPTIONS RESULTS
  18.  
  19. IF ~SHOW('P','WRITE') then
  20. do
  21.   say "This script is for use with the WRITE editor"
  22.   say "Use AUTODOC.REXX from CLI."
  23.   exit 0
  24. end
  25.  
  26. address 'WRITE'
  27.  
  28. 'VERSIONCHECK 40000 "autodoc.wrx"'
  29. IF RC~=0 THEN DO
  30.   exit 10
  31. END
  32.  
  33.  
  34. 'GetVar (_CurrentWord)'
  35. word = RESULT
  36. err = RC
  37. do while ((word = "RESULT") & (err = 0))
  38.   'CursorLeft 0'
  39.   err = RC
  40.   'GetVar (_CurrentWord)'
  41.   word = RESULT
  42. end
  43. if err ~= 0 then
  44. do
  45.   'MessageOK (You must have a word in the active window!)'
  46.   exit 0
  47. end
  48.  
  49. 'GetVar (_FilePath)'
  50. path = RESULT
  51.  
  52. call pragma(DIRECTORY,path)
  53.  
  54. IF ~SHOW('L','amigaguide.library') THEN
  55.    CALL ADDLIB('amigaguide.library',0,-30)
  56.  
  57. /* See if the Autodoc cross-reference table is loaded */
  58. line = GetXRef("OpenWindow()")
  59. IF line = 10 THEN DO
  60.  
  61.    /* The Autodoc table wasn't loaded, so load it. */
  62.    call LoadXRef(autodocs.xref)
  63.    END
  64.  
  65. /* See if the word is in the cross-reference table */
  66. function = word
  67. xref = 0
  68. line = GetXRef(function)
  69. IF line = 10 THEN DO
  70.   /* Add the parens to the name */
  71.   function = word||"()"
  72.  
  73.   /* Try again */
  74.   line = GetXRef(function)
  75.   IF line = 10 THEN DO
  76.      function = word
  77.   END
  78.   ELSE DO
  79.      xref = 1
  80.   END
  81. END
  82. ELSE DO
  83.   xref = 1
  84. END
  85.  
  86. if line ~= 10 then
  87. do
  88.   parse var line node file xref offset
  89.   node = compress(node,'"')
  90.   file = compress(file,'"')
  91.   call ShowNode(,file,node,offset,xref)
  92. end
  93. else do
  94.   cmd = "run MultiView "||function
  95.   ADDRESS COMMAND cmd
  96. END
  97.  
  98.